package com.campus.shop.exception;

import com.campus.shop.common.Errors;
import lombok.Getter;

/**
 * @Description:自定义异常
 * @Author: xr
 * @Date: 2023/3/6 16:54
 */
@Getter
public class ServiceException extends RuntimeException {
    //序列化唯一号
    private static final long serialVersionUID = 1L;

    private Integer code;
    private String message;

    public ServiceException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public ServiceException(String msg) {
        this.message = msg;
    }

    public ServiceException(Errors errors) {
        this.code = errors.getCode();
        this.message = errors.getMsg();
    }
}
